package com.birdpiss.commons.domain;

/**
 * The Enum AccountType.
 *
 * @author mark
 */
public enum AccountType {

	CHECKING(1),
	SAVINGS(2);

	private Integer value;

	/**
	 * Instantiates a new account type.
	 *
	 * @param value the value
	 */
	private AccountType(Integer value) {
		this.value = value;
	}

	/**
	 * Value.
	 *
	 * @return the integer
	 */
	public Integer value() {
		return this.value;
	}

	/**
	 * Gets the account type.
	 *
	 * @param accountType the account type
	 *
	 * @return the account type
	 */
	public static AccountType getAccountType(Integer accountType) {
		switch (accountType) {
			case 1:
				return CHECKING;
			case 2:
				return SAVINGS;
			default:
				return null;
		}
	}

	/**
	 * To string.
	 *
	 * @param accountType the account type
	 *
	 * @return the string
	 */
	public static String toString(AccountType accountType) {
		switch (accountType) {
			case CHECKING:
				return "CHECKING";
			case SAVINGS:
				return "SAVINGS";
			default:
				return "NULL";
		}
	}

}
